package edu.hit.irlab.coref.features.pair;

import java.util.List;

import nlpeap.ml.FeatureDescription;
import nlpeap.ml.FeatureType;

import edu.hit.irlab.coref.PairFeatureExtractor;
import edu.hit.irlab.coref.PairInstance;

/**
 * The String Match Feature (soon 2001)<br>
 * In our system, we just check whether the heads of the 
 * two mentions are match
 * @author chuter
 *
 */
public class FE_StrMatch implements PairFeatureExtractor {
    
    public static final FeatureDescription<Boolean> FD_IS_STRINGMATCH=
        new FeatureDescription<Boolean>(FeatureType.FT_BOOL, "StringMatch");
    
    public void describeFeatures(List<FeatureDescription> fds) 
    { fds.add(FD_IS_STRINGMATCH); }

    public void extractFeatures(PairInstance inst) 
    { inst.setFeature(FD_IS_STRINGMATCH, getStringMatch(inst)); }
    
    public boolean getStringMatch(PairInstance inst)
    {   
    	return inst.getAnaphor().getHead().equalsIgnoreCase(
    			inst.getAntecedent().getHead());
    }
}
